using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ByHand.Model;
using ByHand.Data;
using ByHand.Services.Interfaces;
using ByHand.Data.Interfaces;
using ByHand.Services.Code;

namespace ByHand.Services.Implements
{
    public class ProductOptionService : RepositoryBase<ProductOption>, IProductOptionService
    {
        public ProductOptionService(IDatabaseFactory DbFactory) : base(DbFactory) { }

        public List<ProductOption> GetByProductID(int productID)
        {
            return (from po in ByHandDB.ProductOptions
                    where po.ProductID == productID
                    select po).ToList();
        }
        public void RemoveAllOption(int productID) {
            var lOP = GetByProductID(productID);
            foreach (var item in lOP)
            {
                Delete(item);
            }
        }

    }
}
